export const timeFix = () => {
  const time = new Date()
  const hour = time.getHours()
  return hour < 9 ? '早上好' : hour <= 11 ? '上午好' : hour <= 13 ? '中午好' : hour < 20 ? '下午好' : '晚上好'
}

export const hugUniqArry = (array) => {
  var temp = [] //一个新的临时数组
  for (var i = 0; i < array.length; i++) {
    if (temp.indexOf(array[i]) == -1) {
      temp.push(array[i])
    }
  }
  return temp
}

//防抖
export const  debounce=(fn, t) =>{
  const delay = t || 100;
  let timer = null;
  return function() {
      const args = arguments;
      const context = this;
      if (timer) {
          clearTimeout(timer);
      }
      timer = setTimeout(() => {
          timer = null;
          fn.apply(context, args);
      }, delay);
  };
}